# -*- coding:utf-8 -*-
from uiautomator import device as d


# ***************************方法**************************************
# 判断控件是否存在 & text
def check_controls_exists(controls_text):
    return d(text=controls_text).exists


def check_controls_exists_by_resourceid(controls_resourceid):
    return d(resourceId=controls_resourceid).exists


# 判断按钮是否置灰 & text & clickable
def check_controls_click_text(controls_text):
    return d(text=controls_text).info.get("clickable")


def check_controls_checked_by_text(controls_text):
    return d(text=controls_text).info.get("checked")


# assertIn(a, b)     a in b
def check_ainb(resourceid, b):
    if d(resourceId=resourceid).info.get("text") in b:
        return 1
    else:
        return 0

# ***********************************************************
